package com.atguigu.gmall.publisher.mapper;

import com.atguigu.gmall.publisher.bean.TestQuestionBean;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface TestQuestionMapper {
    @Select("select\n" +
            "    question_id questionId,\n" +
            "    sum(answerRightTimeCt) answerRightTimeCount,\n" +
            "    sum(answerTimeCt) answerTimeCount,\n" +
            "    sum(answerRightUvCt) answerRightUvCount,\n" +
            "    sum(answerUvCt) answerUvCount,\n" +
            "    sum(answerRightTimeCt)/sum(answerTimeCt) answerRightRate,\n" +
            "    sum(answerRightUvCt)/sum(answerUvCt) answerRightUvRate\n" +
            "from dws_test_exam_question_count_window\n" +
            "where toYYYYMMDD(stt) = #{date}\n" +
            "group by question_id,toYYYYMMDD(stt);")
    List<TestQuestionBean> selectTestQuestionBean(@Param(value = "date")Integer date);

}
